package design.mode.effective_java.chapter9.item61;

import java.util.Comparator;

/**
 * @author ZhongMingde on 2021/9/1
 */

public class Test1 {
    //破损的比较器——你能发现它的缺陷吗?
    public static void main(String[] args) {
        Comparator<Integer> naturalOrder = (i, j) -> (i < j) ? -1 : (i == j ? 0 : 1);
        System.out.println(naturalOrder.compare(new Integer(30), new Integer(30)));

        Comparator<Integer> naturalOrder2 = (iBoxed, jBoxed) -> {
            int i = iBoxed;
            int j = jBoxed;
            return i < j ? -1 : (i == j ? 0 : 1);
        };
        System.out.println(naturalOrder2.compare(new Integer(30), new Integer(30)));

    }
}
